package mathExpEvaluator.model;

import java.util.ArrayList;
import java.util.List;

public class Operant {
//	private List<Operant> operants;
//	private Operator operator;
//	private MathValue value;
//
//	public Operant(MathValue value) {
//		this.value = value;
//	}
//
//	public Operant(List<Operant> operants, Operator operator) {
//		this.operants = operants;
//		this.operator = operator;
//	}
//
//	public List<Operant> getOperants() {
//		return operants;
//	}
//
//	public Operator getOperator() {
//		return operator;
//	}
//
//	public MathValue eval() {
//		if (operator != null) {
//			List<MathValue> ops = new ArrayList<MathValue>();
//			for (Operant operant : operants) {
//				ops.add(operant.eval());
//			}
//			return operator.apply(ops);
//		} else {
//			return value;
//		}
//	}
	
	private final List<MathValue> values;
	private final Operator operator;
	
	public Operant(List<MathValue> values, Operator operator){
		this.values = values;
		this.operator = operator;
	}
	
	public MathValue eval(){
		return operator.apply(values);
	}
	
	public String toString(){
		return operator.getStringForm(values);
	}
}
